//
//  HiddenButton.m
//  Model
//
//  Created by YDJH on 2017/6/5.
//  Copyright © 2017年 YDJH. All rights reserved.
//

#import "HiddenButton.h"
#import "HZHiddenFurniture.h"
@interface HiddenButton ()



@end

@implementation HiddenButton


- (instancetype)init {
    self = [super init];
    if (self) {
        self.userInteractionEnabled = YES;
        
        [self initView];
    }
    return self;
}

- (void)initView {
    


}

- (void)setHiddenFurniture:(HZHiddenFurniture *)hiddenFurniture {
    _hiddenFurniture = hiddenFurniture;
    UIImage *image = [UIImage imageNamed:hiddenFurniture.picture];
    self.frame = CGRectMake(0, 0, image.size.width, image.size.height);
//    self.center = CGPointMake(CGRectGetWidth(self.frame)/2, CGRectGetHeight(self.frame)/2);
    [self setImage:image forState:UIControlStateNormal];
    NSArray *positionxy = [self.hiddenFurniture.position componentsSeparatedByString:@","];
    self.center = CGPointMake([[positionxy firstObject] floatValue], [[positionxy lastObject] floatValue]);
//    self.hidden = YES;
}



- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:touches withEvent:event];
    
    self.hiddenfurnitureblock(self.hiddenFurniture);
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
